package com.yuanchu.goods.config;

import org.springframework.context.annotation.Configuration;

/**
 * @version: 1.0
 * @Author: adan
 * @description:
 * @date: 2024-02-23 17:29
 */
@Configuration
public class DearMessageConfig {
    // 声明普通的 paynotify_goods_queue队列，并且为其指定死信交换机：dl.direct
    public static final String PAYNOTIFY_GOODS_QUEUE = "paynotify_goods_queue";

    // 声明存储死信的队列
    public static final String DL_GOODS_QUEUE = "dl_goods_queue";

    public static final String DL_GOODS_DIRECT = "dl_goods_direct";
    public static final String DL_MARKET_KEY = "goods";

    // @Bean
    // public Queue simpleQueue2(){
    //     return QueueBuilder.durable(PAYNOTIFY_GOODS_QUEUE) // 指定队列名称，并持久化
    //             .deadLetterExchange(DL_GOODS_DIRECT) // 指定死信交换机
    //             .build();
    // }
    //
    // // 声明死信交换机 dl.direct
    // @Bean(DL_GOODS_DIRECT)
    // public DirectExchange dlExchange(){
    //     return new DirectExchange(DL_GOODS_DIRECT, true, false);
    // }
    // @Bean(DL_GOODS_QUEUE)
    // public Queue goodsDirectStoreQueue() {
    //     return QueueBuilder.durable(DL_GOODS_QUEUE).build();
    // }
    //
    // @Bean
    // public Binding bindingOrderPayqueue(@Qualifier(DL_GOODS_QUEUE) Queue queue, @Qualifier(DL_GOODS_DIRECT) DirectExchange exchange) {
    //     return BindingBuilder.bind(queue).to(exchange).with(DL_MARKET_KEY);
    // }
    //
    // // 声明存储死信的队列 dl.queue
    // @Bean
    // public Queue dlQueue(){
    //     return new Queue(DL_GOODS_QUEUE, true);
    // }
    // // 将死信队列 与 死信交换机绑定
    // @Bean
    // public Binding dlBinding(){
    //     return BindingBuilder.bind(dlQueue()).to(dlExchange()).with(DL_MARKET_KEY);
    // }

}
